﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using IRC.IRepairClouds.DataLayer;

namespace IRC.IRepairClouds.WebClient
{
    public class AuthItemPartners
    {
        public int? PClientId { get; set; }
        public int? PCSCId { get; set; }
        public int? PLogisticsId { get; set; }
        public int? PIncentiveHandlingsId { get; set; }
        public int? PClearingId { get; set; }
        public int? PPaymentId { get; set; }
        public int? POfflineId { get; set; }
        public AuthRequirements AnyAllowed { get; set; }

        public Dictionary<EPartnerRole.PartnerRoles, int> GetPartnersIds()
        {
            var res = new Dictionary<EPartnerRole.PartnerRoles, int>();
            AddPartnerId(res, EPartnerRole.PartnerRoles.Client, PClientId);


            AddPartnerId(res, EPartnerRole.PartnerRoles.PartnerCoordinator, (int)EPartner.Partner.GreeNova);
            return res;
        }

        private void AddPartnerId(Dictionary<EPartnerRole.PartnerRoles, int> roles, EPartnerRole.PartnerRoles role, int? roleId)
        {
            if (roleId != null)
                roles[role] = roleId.Value;
        }
    }

    public class AuthItemPartner
    {
        public int? PartnerId { get; set; }
        public EUserRole.Role UserRole { get; set; }
    }
}